import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_demo_app/video_preview.dart';

class setTimeout extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => setTimeoutState();
}


class setTimeoutState extends State<setTimeout> {
  var timer;

  @override
  void initState() {
    super.initState();
    timer = new Timer(const Duration(milliseconds: 1500), () {
      try {
        print('yachi');
//        Navigator.of(context).pushAndRemoveUntil(new MaterialPageRoute(
//            builder: (BuildContext context) => new videoPreview()), (//跳转到主页
//            Route route) => route == null);
      } catch (e) {
        print(e);
      }
    });
  }

  @override
  void dispose() {
    timer.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: new AppBar(
        backgroundColor: Colors.deepOrange,
        elevation: 0.0,
        title: new Text(
          "延迟执行",
          style: new TextStyle(
              color: Colors.white,
              fontSize: 18.0,
              fontWeight: FontWeight.normal),
        ),
      ),
      body: new Container(
        color: Colors.white,
        padding: const EdgeInsets.only(top: 42.0),
        child: new Column(children: <Widget>[]),
      ),
    );
  }
}
